package future;

import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;

public class Test02 {
    public static void main(String[] args) {
        ListeningExecutorService service = MoreExecutors.newDirectExecutorService();
        ListenableFuture<?> future = service.submit(() -> 1);
        future.addListener(() -> {
            System.out.println("开始监听!");
            //todo continue do sth.
        }, service);
    }

}
